home *** CD-ROM | disk | FTP | other *** search
- Path: druid.borland.com!usenet
- From: pete@borland.com (Pete Becker)
- Newsgroups: comp.lang.c++
- Subject: Re: MSVC++ 4.0 compiler really doesn't call subclassed virtual functions in this case.
- Date: 29 Feb 1996 16:46:42 GMT
- Organization: Borland International
- Message-ID: <4h4l9i$4fh@druid.borland.com>
- References: <4gnpf9$q8o@ccnet2.ccnet.com>
- NNTP-Posting-Host: pbecker.borland.com
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=ISO-8859-1
- X-Newsreader: WinVN 0.99.5
-
- In article <4gnpf9$q8o@ccnet2.ccnet.com>, paulp@ccnet.com says...
- >
- >I've got this problem that I know is not my fault. I declare classes
- > class A{
- > virtual blah();
- > };
- >
- > class B:public A{
- > virtual blah();
- > };
- >
- > B myB;
- >
- >And at runtime, calling myB.blah(); causes E:blah() to be called. The reason
- I
- >know it is not my fault is because it goes away if I delete the object files
- for
- >A and B and recompile. The first time after deleting the object files, the
- bug
- >goes away, then the next compile (without re-deleting the obj files) the bug
- >comes back. Thus I can fix the problem by always deleting the obj files
- before
- >compiling.
- >
- >Has anybody else had this problem with VC++ 4.0? Is it related to incremental
- >compiling and linking?
- >
- >My guess is that if you compile the above example, code, you won't see this
- >problem, as in my case the classes aren't quite so simple, and only happen
- for
- >some classes, and not for others.
-
- That sort of problem typically comes up when you change the definition of a
- class and then for some reason don't recompile all the source files that use
- that definition. The old .OBJ files were built with the old definition, and
- the new ones were built with the new definition. That's a recipe for disaster.
- So check your build process. It is also possible that this is a result of
- incremental compiling: if that isn't working right, it could easily produce
- this sort of problem.
- -- Pete
-
-